package cn.jhg.account.rest;

import java.util.List;

import javax.annotation.Resource;

import cn.jhg.account.entity.MaterialPackage;
import cn.jhg.account.service.MaterialPackageSvc;
import cn.jhg.account.util.ServiceResult;

public class MaterialPackageRestImpl implements MaterialPackageRest{
	
	@Resource
	private MaterialPackageSvc materialPackageSvc;

	 /**
   	 * <p>新增物料件</p>
   	 * @return		新增物料件的id
   	 */
	@Override
	public ServiceResult<Integer> addMaterialPackage(String seq, int labId, double quantity, int statId, int batId,
			int locTranId, int locStoId, String propId, int iuid) {
		MaterialPackage materialPackage=new MaterialPackage();
		materialPackage.setSeqNo(seq);
		materialPackage.setLabId(labId);
		materialPackage.setQuantity(quantity);
		materialPackage.setStatId(statId);
		materialPackage.setBatId(batId);
		materialPackage.setLocTranId(locTranId);
		materialPackage.setLocStoId(locStoId);
		materialPackage.setPropId(propId);
		ServiceResult<Integer> serviceResult=materialPackageSvc.addPackage(materialPackage, 0, iuid);
		return serviceResult;
	}

	/**
  	 * <p>更新物料件</p>
  	 * @return		errorCode
  	 */
	@Override
	public ServiceResult<Object> updatePackage(int id, String seq, int labId, double quantity, int statId, int batId,
			int locTranId, int locStoId, String propId, int iuid) {
		MaterialPackage materialPackage=new MaterialPackage();
		materialPackage.setId(id);
		materialPackage.setSeqNo(seq);
		materialPackage.setLabId(labId);
		materialPackage.setQuantity(quantity);
		materialPackage.setStatId(statId);
		materialPackage.setBatId(batId);
		materialPackage.setLocTranId(locTranId);
		materialPackage.setLocStoId(locStoId);
		materialPackage.setPropId(propId);
		ServiceResult<Object> serviceResult=materialPackageSvc.updatePackage(materialPackage, 0, iuid);
		return serviceResult;
	}

	/**
  	 * <p>删除物料件</p>
  	 * @return		errorCode
  	 */
	@Override
	public ServiceResult<Object> deletePackage(int id, int iuid) {
		ServiceResult<Object> serviceResult=materialPackageSvc.deletePackage(id, 0, iuid);
		return serviceResult;
	}

	/**
	 * <p>根据id查询物料件</p>
	 * @return		物料件
	 */
	@Override
	public ServiceResult<MaterialPackage> queryPackageById(int id, int iuid) {
		ServiceResult<MaterialPackage> serviceResult=materialPackageSvc.queryPackageById(id, iuid);
		return serviceResult;
	}

	/**
	 * <p>根据labId查询物料件</p>
	 * @return		物料件
	 */
	@Override
	public ServiceResult<MaterialPackage> queryPackageByLabel(int labId, int iuid) {
		ServiceResult<MaterialPackage> serviceResult=materialPackageSvc.queryPackageById(labId, iuid);
		return serviceResult;
	}

	/**
	 * <p>查询设备类型</p>
	 * @return		设备类型
	 */
	@Override
	public ServiceResult<List<MaterialPackage>> findPackageDetail(int batId, String seq, int locStoId, int locTranId,
			int statId, int iuid) {
		ServiceResult<List<MaterialPackage>> serviceResult=materialPackageSvc.findPackageDetail(batId, seq, locStoId, locTranId, statId, iuid);
		return serviceResult;
	}

}
